﻿using System;
using System.Windows.Forms;
using WeatherInformer;

namespace UserInterface
{
    public partial class ForecastSystem : Form
    {
        private WeatherInfo Weather { get; set; }

        public ForecastSystem()
        {
            InitializeComponent();
            Weather = new WeatherInfo();
            //ShowCurrentWeather();
            //PrintPicture();
        }

        #region Picture

        private void btnUpdatePicture_Click(object sender, EventArgs e)
        {
            PrintPicture();
        }

        private void PrintPicture()
        {
            chartForecast.Series[0].Points.AddXY(1, 5);
            chartForecast.Series[0].Points.AddXY(10, 15);
            chartForecast.Series[0].Points.AddXY(11, 25);
            chartForecast.Series[0].Points.AddXY(21, 15);
        }
        #endregion

        #region Weather
        private void btnUpdateWeather_Click(object sender, EventArgs e)
        {
            Weather.UpdateConditions();
            ShowCurrentWeather();
        }

        private void ShowCurrentWeather()
        {
            lblCityValue.Text = Weather.GasPumpingUnitLocation;
            lblUpdatedValue.Text = String.Format("{1}\n{0}", Weather.Conditions.Date.ToString(), Weather.Conditions.Time.ToString());
            lblTemperatureValue.Text = Weather.Conditions.Temperature.ToString() + " C";
            lblPressureValue.Text = Weather.Conditions.Pressure.ToString() + " Pa";
            lblHumidityValue.Text = Weather.Conditions.Humidity.ToString() + " %";
        }
        #endregion
    }
}
